<template>
  <div class="common-table">
    <el-table :data="tableData" height="60vh" stripe>
      <el-table-column show-overflow-tooltip v-for="item in tableLable" :key="item.prop" :label="item.label"
        :width="item.width ? item.width : 125">
        <template slot-scope="scope">
          <span style="margin-left:10px"> {{ scope.row[item.prop] }}</span>
        </template>

      </el-table-column>

      <el-table-column label="操作" min-width="180">
        <template slot-scope="scope">
          <el-button size="mini" @click="handleEdit(scope.row)">编辑</el-button>
          <el-button size="mini" type="danger" @click="handleDelent(scope.row)">删除</el-button>
        </template>

      </el-table-column>



    </el-table>

    <el-pagination class="pager" layout="prev,pager,next" 
    :total="currentStep2"
     :current-page.sync="currentStep"
      @curent-change="changePage" :page-size="20">

    </el-pagination>

  </div>
</template>

<script>
export default {
  name: 'MagementComponenttable',
  props: {
    tableData: Array,
    tableLable: Array,
    config: Object
  },
  data() {
    return {
      page:this.config.page,
      total:this.config.total


    };
  },
  computed: {
    // page1(){
    //   console.log(this.paeg);
    //   return   this.page
    // }
    currentStep: {
      get() {
        var page = this.config.page;

        console.log(page);
        

        return page
      },
      set() { }

    },
     currentStep2: {
      get() {
        var total = this.config.total;
        
        console.log(total);
        

        return total
      },
      set() { }

    },

  },


  mounted() {

  },

  methods: {
    handleEdit(row) {
      this.$emit('edit', row);

    },
    handleDelent(row) {
      this.$emit('del', row);


    },
    changePage(page) {
      this.$emit('page', page);

    }
  },
};
</script>

<style lang="less" scoped>
.common-table {
  width: 100%;
  height: calc(100% - 62px);
  background-color: #fff;
  position: relative;

  .pager {

    position: absolute;
    bottom: 0;
    right: 20px;
  }
}
</style>